//
//  NetSetting.m
//  CarCare
//
//  Created by ileo on 15/2/7.
//  Copyright (c) 2015年 baozun. All rights reserved.
//

#import "NetSetting.h"
#import "AIUserInfo.h"
#import "NetEngineServer.h"
@implementation NetSetting

NSString * const REQUEST_VIBRATION_ONOFF = @"/setting/setVibration";// 设置震动开关
NSString * const REQUEST_TRIP_ONOFF = @"/setting/tripSwitch";// 设置行程通知开关接口
NSString * const REQUEST_FIRE_ONOFF = @"/setting/fireSwitch";// 设置点火通知开关接口
NSString * const REQUEST_VOLTAGE_ONOFF = @"/setting/VoltageFlag";//设置电压开关
NSString * const REQUEST_VOLTAGE_VALUE = @"/setting/setVoltageValue";//设置报警电压
NSString * const REQUEST_TRAJECTORY_ONOFF = @"/setting/tripOrbitSwitch";//车辆轨迹开关接口
NSString * const REQUEST_GESTURE_ONOFF = @"/setting/setGuesture";//设置手势密码开关


+(void)setVibration:(BOOL)state finish:(void(^)())finish failure:(void(^)())failure{
    [[__SELF request:REQUEST_VIBRATION_ONOFF withParams:@{@"flag":(state?@(1):@(0)),@"value":@""} type:REQUEST_POST] requestSuccess:finish failure:failure];
}

+(void)setFire:(BOOL)state finish:(void(^)())finish failure:(void(^)())failure
{
    [[__SELF request:REQUEST_FIRE_ONOFF withParams:@{@"flag":(state?@(1):@(0))} type:REQUEST_POST] requestSuccess:finish failure:failure];
}

+(void)setTrip:(BOOL)state finish:(void(^)())finish failure:(void(^)())failure{
    [[__SELF request:REQUEST_TRIP_ONOFF withParams:@{@"flag":(state?@(1):@(0))} type:REQUEST_POST] requestSuccess:finish failure:failure];
}

+(void)setVoltage:(BOOL)state{
    [[__SELF request:REQUEST_VOLTAGE_ONOFF withParams:@{@"flag":(state?@(1):@(0))} type:REQUEST_POST] requestOnly];
}
+(void)setTrajectory:(BOOL)state
{
    [[__SELF request:REQUEST_TRAJECTORY_ONOFF withParams:@{@"flag":(state?@(1):@(0))} type:REQUEST_POST] requestOnly];
}
//设置手势密码开关等 gesturePWState手势密码开1/关0  canLookGesturePWState显示手势轨迹开1/关0  gesturePWStr手势密码
+(void)setGesturePWSwitch:(BOOL)gesturePWState withCanLookGesturePW:(BOOL)canLookGesturePWState withGesturePWStr:(NSString *)gesturePWStr
{
    [[__SELF request:REQUEST_GESTURE_ONOFF withParams:@{@"guesturePasswordFlag":(gesturePWState?@(1):@(0)), @"showGuestureOrbitFlag":(canLookGesturePWState?@(1):@(0)),@"guesturePassword":gesturePWStr} type:REQUEST_POST] requestOnly];
}

+(void)setVoltageValue:(NSString *)value{
    [[__SELF request:REQUEST_VOLTAGE_VALUE withParams:@{@"value":value} type:REQUEST_POST] requestOnly];
}
+(NetSetting *)currentVoltageValue{
    return [__SELF request:@"/setting/getVoltageInfo" withParams:@{} type:REQUEST_POST];
}

+(NetSetting *)getSettingInfo{
    return [__SELF request:@"/setting/getSwitchs" withParams:@{} type:REQUEST_POST];
}
+(NetSetting *)getGustureInfoSetting
{
    return [__SELF request:@"/setting/getGuestureInfo" withParams:@{} type:REQUEST_POST];
}
+(NetSetting *)getTestGestureMsgCode:(NSString *)codeMsg
{
    return [__SELF request:@"/setting/verifyValidation" withParams:@{@"tel":USERINFO.tel,@"code":codeMsg} type:REQUEST_POST];
}
-(NSDictionary *)requestCommonParams{
    if (![USERINFO.session isNotNil]) {
        return nil;
    }
    return @{@"userid":@(USERINFO.userID), @"imei":USERINFO.pastDevice,@"session":USERINFO.session};
}

@end